<?php
/**
 * Created by PhpStorm.
 * User: 13469
 * Date: 2018/12/8
 * Time: 14:53
 */
include "config.php";

if($_SERVER["REQUEST_METHOD"]=="POST"){
    session_start();
    if(isset($_REQUEST["utel"])&&isset($_REQUEST["upwd"])){

        $UTEL=$_REQUEST["utel"];
        $UPWD=$_REQUEST["upwd"];
        $sql="SELECT u_id,u_tel FROM userinfo WHERE u_tel=? AND u_pwd=?";
        $stmt=$conn->prepare($sql);
        $stmt->bind_param("ss", $UTEL, $UPWD);
        $stmt->execute();
        $res=$stmt->get_result();
        if($res->num_rows>=1){
           // $_SESSION["userInfo"]=$res->fetch_assoc();
            print_r(json_encode(array("status"=>1,"msg"=>"登录成功","data"=>$res->fetch_assoc())));
        }else{
            print_r(json_encode(array("status"=>-1,"msg"=>"手机号或密码错误")));
        }
    }
}else{
    print_r(json_encode(array("status"=>0,"msg"=>"不支持get请求")));
}